package com.xsjl.base.controller;

import com.xsjl.common.entity.Result;
import com.xsjl.common.entity.StatusCode;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @ClassName BaseExceptionHandler
 * @Description TODO
 * @Author PRETEXT
 * @Date2020/2/27 22:08
 * @Version V1.0
 **/
@RestControllerAdvice
@CrossOrigin
public class BaseExceptionHandler {
    @ExceptionHandler
    public Result errorHandler(Throwable e) {
        e.printStackTrace();
        return new Result(false, StatusCode.ERROR, e.getMessage());
    }
}
